package com.geqian.web.serializer;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
//这个注解用来标记Jackson复合注解,当你使用多个Jackson注解组合成一个自定义注解时会用到它
@JacksonAnnotationsInside
//指定使用自定义的反序列化器
@JsonDeserialize(using = ConversionDeserializer.class)
//指定使用自定义的序列化器
@JsonSerialize(using = ConversionSerializer.class)
public @interface PropertyConverter {

    Class<? extends SerializationConverter> serializationConverter() default SerializationConverter.class;

    Class<? extends DeserializationConverter> deserializationConverter() default DeserializationConverter.class;

}